package com.pzr.soccer.runner;

import com.pzr.soccer.dao.PlanRepository;
import com.pzr.soccer.service.ScanChangeGameProcessor;
import com.pzr.soccer.watched.PlanWatched;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Author pzr
 * @date:2021-12-20-15:35
 * @Description:
 **/
@Component
public class InitRunner implements ApplicationRunner {
    @Autowired
    ScanChangeGameProcessor scanChangeGameProcessor;
    @Autowired
    PlanWatched planRepositoryImpl;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("init some components....");
        //初始化redis plans序列
        System.out.println("初始化redis plans序列....");
        scanChangeGameProcessor.initPlans();

        System.out.println("scanChangeGameProcessor注册到 planRepository observers 列表..");
        planRepositoryImpl.registry(scanChangeGameProcessor);
    }
}
